
public class WeaversConfiguredInstanceLinker
{
    public ProjectWeaversReader ProjectWeaversReader;
    public WeaverAssemblyPathFinder WeaverAssemblyPathFinder;
    public BuildLogger Logger;
    public WeaverProjectFileFinder WeaverProjectFileFinder;

    public void Execute()
    {
        if (ProjectWeaversReader.Weavers.Count == 0)
        {
            return;
        }

        foreach (var weaverConfig in ProjectWeaversReader.Weavers)
        {
            var assemblyPath = WeaverAssemblyPathFinder.FindAssemblyPath(weaverConfig.AssemblyName);
            if (assemblyPath == null)
            {
                throw new WeavingException(string.Format("Could not find a weaver named '{0}'.", weaverConfig.AssemblyName));
            }
            weaverConfig.AssemblyPath = assemblyPath;
            weaverConfig.TypeName = "ModuleWeaver";
        }

        if (ProjectWeaversReader.InSolutionWeavingEnabled)
        {
            if (WeaverProjectFileFinder.Found && !WeaverAssemblyPathFinder.WeaverProjectUsed)
            {
                var weaverProjectContainsType = WeaverAssemblyPathFinder.WeaverProjectContainsType("ModuleWeaver");
                if (weaverProjectContainsType)
                {
                    Logger.LogInfo(string.Format("'ModuleWeaver' from project 'Weavers' was not listed in '{0}' so it has been appended to the end of weavers.", ProjectWeaversFinder.ConfigFileName));
                    var weaverEntry = new WeaverEntry
                                            {
                                                AssemblyPath = WeaverProjectFileFinder.WeaverAssemblyPath,
                                                TypeName = "ModuleWeaver"
                                            };
                    ProjectWeaversReader.Weavers.Add(weaverEntry);
                }
            }
        }
    }
}